srvMap.add('queryTouristSourceList','','front/sh/analysis!execute?uid=queryTouristSourceList');
var myChart_regionPieCharts; //省内、省外、境外来源饼图
var myChart_regionMapCharts; //迁徙图--新增省内/外柱状图
//省外1 省内2 境外3
var isShowProvData = true;	//是否展示省外数据
var isShowBarChart = false;	//是展示柱状图还是地图
var currentCity = DEPLOY_PROVINCE_CAPITAL_NAME;	//在全省迁徙图时，默认以南宁为中心
var toolTipPalce=DEPLOY_PROVINCE_NAME;
var paramObj = {};
//缓存省内/外/境外数据
var provInfo = {};
var cityInfo = {};
var fornInfo = {};
//var provRankTopArray = [];	//省外top数据缓存
//var cityRankTopArray = [];	//省内top数据缓存

var RANK_TOP_NUM = 6;	//排名top数
var FORN_Rank_Top_NUM=31 //境外来源分析排名top数
$(function() {

	$(document).ready(function(){
		Util.loadUpInfo.initCityList();
		Util.loadUpInfo.initRegionTypleList();
		Util.loadUpInfo.initRegionList();
		$('input[name="dataTimeType"][value="day"]').attr("checked","checked");
		initDataTime();
		//省内省外切换
//		$(".topTitle").on("click",function(){
//			if( isShowProvData ){
//				
//				//切换时，未选择地市条件
//				var cityId =  $('#citySelect span li').attr("d_value");	
//
//				if (cityId == null || cityId == '' || cityId == '999') {
//					alert("展示省内来访排名，请先选择地市！");
//					return;
//				}
//				currentCity = $('#citySelect').text();
//				isShowProvData = false;
//			}else{
//				isShowProvData = true;
//			}
//			
//			refreshPageData();
//		});
		
		$(".topTitle").on("click",function(){
			if($(this).text()=="省内来访地市排名TOP6"){
				//切换时，未选择地市条件
				var cityId =  $('#citySelect span li').attr("d_value");	
				if (cityId == null || cityId == '' || cityId == '999') {
					alert("展示省内来访排名，请先选择地市！");
					return;
				}
				//切换游客来源类型
				var text=$("#showTopTitle").text();
				$("#showTopTitle").text($(this).text());
				$(this).text(text);
				if(validParams()){
				currentCity = $('#citySelect').text();
				refreshPageData();}
				else{
					$(".select_button").trigger("click");
				}
			}else{
				var text=$("#showTopTitle").text();
				$("#showTopTitle").text($(this).text());
				$(this).text(text);
				
				if(validParams()){
					currentCity = $('#citySelect').text();
					refreshPageData();}
				else{
					$(".select_button").trigger("click");
					}
			}
			
		})
		
		//绑定查询事件
		$(".select_button").on("click",function(){
			toolTipPalce=$('#citySelect').text()=="全省"?DEPLOY_PROVINCE_NAME:$('#citySelect').text();
			currentCity = $('#citySelect').text();
			if( currentCity == "全省" ){
				currentCity = DEPLOY_PROVINCE_CAPITAL_NAME;
			}
			
			//获取界面参数
			
			paramObj.cityId = $('#citySelect span li').attr("d_value")|| "";
			paramObj.regionId = $('#inputselect').val()|| "";
			paramObj.cycleId = $('input[name="dataTimeType"]:checked').val();
			
			if( paramObj.cycleId == 'day'){
				paramObj.startTime = $('#dayStart').val().replace("-","").replace("-","");
				paramObj.endTime = $('#dayEnd').val().replace("-","").replace("-","");
			}else{
				paramObj.startTime = $('#monthStart').val().replace("-","");
				paramObj.endTime = $('#monthEnd').val().replace("-","");
			}
			

			if( paramObj.startTime == null || paramObj.startTime.length == 0 ){
				alert("请选择查询开始时间！");
				return false;
			}
			
			if( paramObj.endTime == null || paramObj.endTime.length == 0 ){
				alert("请选择查询结束时间！");
				return false;
			}
			
			//如果选择了regionId，则忽略类型参数
			if( paramObj.regionId == null || paramObj.regionId.length == 0 ){
				paramObj.regionType = $('#regionTypleSelect span li').attr("d_value")|| "";
			}
			
			queryTouristSourceData(paramObj);
			
		});
		
		//绑定日期类型radio切换事件
		$('input[name=dataTimeType]').on("change",function(){
			if( $(this).val() == "day" ){
				$("#dayStartDiv").show();
				$("#dayEndDiv").show();
				//var date=now_Date.format("yyyy-MM-dd"); 
				//$("#dayStart").val(date);
				$("#monthStartDiv").hide();
				$("#monthEndDiv").hide();
			}else{
				
				$("#monthStartDiv").show();
				$("#monthEndDiv").show();
				$("#dayStartDiv").hide();
				$("#dayEndDiv").hide();
			}
		});
		
		//跳转到详情页面，
		$("#toDetailUrl").on("click",function(){
			var paramStr = getParamsStr();
			var detailUrl = CONTENT_PATH+"/zhly/analysis_come_detail.jsp"+paramStr+"&FORN_Rank_Top_NUM="+FORN_Rank_Top_NUM;
			location.href= encodeURI(detailUrl);
			return false;
		});
		
		//地图和柱状图之间进行切换
		$(".funcButton").on("click",function(){
			if( $(this).attr("id") == "showBarBtn" ){
				isShowBarChart = true;
				$("#showBarBtn").addClass("buttonOn");
				$("#showMapBtn").removeClass("buttonOn");
			}else{
				isShowBarChart = false;
				currentCity = $('#citySelect').text();
				$("#showMapBtn").addClass("buttonOn");
				$("#showBarBtn").removeClass("buttonOn");
			}
			refreshPageData();
		});
		
		//查询省内/外游客来源数据
		var paramObj = getParamsObj();
		//接收景区子监控页面传来的参数
		if( in_regionId != null && in_regionId.length > 0 ){
			paramObj.regionId = in_regionId;
			$("#divselectInput").val(in_regionName);
			$("#inputselect").val(in_regionId);
		}
		
		queryTouristSourceData(paramObj);
	});
});

function validParams(){
	if(paramObj.cityId != $('#citySelect span li').attr("d_value")){
		return 0;
	}
	
	if(paramObj.regionId != $('#inputselect').val()){
		return 0;
	}
	var cycleId = $('input[name="dataTimeType"]:checked').val();
	
	if( cycleId == 'day'){
		startTime = $('#dayStart').val().replace("-","").replace("-","");
		endTime = $('#dayEnd').val().replace("-","").replace("-","");
	}else{
		startTime = $('#monthStart').val().replace("-","");
		endTime = $('#monthEnd').val().replace("-","");
	}
	if(paramObj.startTime!=startTime||paramObj.endTime!=endTime){
		return 0;
	}

	//如果选择了regionId，则忽略类型参数
	if( paramObj.regionType != $('#regionTypleSelect span li').attr("d_value")){
		return 0;
	}
	return 1;
}

/**
 * 
 * @Description : 刷新页面数据
 * @return void
 * 
 * @author : xuxiong
 * @date : 2015年12月11日 下午15:01
 * 
 */
function refreshPageData(){
	
	//渲染数据
	buildTouristSourceTable();
	
	//根据条件渲染图形
	if( isShowBarChart ){
		if( $("#showTopTitle").text()=="省外来访省份排名TOP6" ){
			buildProvSourceBar(provInfo);
		}else if( $("#showTopTitle").text()=="省内来访地市排名TOP6" ){
			buildCitySourceBar(cityInfo);
		}else{
			buildFornSourceBar(fornInfo);
		}
	}else{
//		if( isShowProvData ){
//			showProvMapCharts(provInfo);
//		}else{
//			showCityMapCharts(cityInfo);
//		}
		if( $("#showTopTitle").text()=="省外来访省份排名TOP6" ){
			showProvMapCharts(provInfo);
		}else if( $("#showTopTitle").text()=="省内来访地市排名TOP6" ){
			showCityMapCharts(cityInfo);
		}else{
			showFornMapCharts(fornInfo);//TODO
		}
	}
}

/**
 * 
 * @Description : 查询省内/外游客来源数据
 * @return void
 * 
 * @author : xuxiong
 * @date : 2015年12月11日 下午15:01
 * 
 */
function queryTouristSourceData(paramObj){
	//获取参数
	var par = "&cityId="+paramObj.cityId+"&provinceId="+DEPLOY_ANALYSIS_PROVINCE_ID+"&regionId="+paramObj.regionId+"&regionName="+paramObj.regionName+"&regionType="+paramObj.regionType+"&cycleId="+paramObj.cycleId+"&startTime="+paramObj.startTime+"&endTime="+paramObj.endTime;
	Util.ajax.postJsonSync(srvMap.get('queryTouristSourceList'),par,function(json,status){
		if(status){			
			var i = 0;
			provInfo.provRankTopArray = [];
			cityInfo.cityRankTopArray = [];
			fornInfo.fornRankTopArray = [];
			provInfo.edgeArray = json.object.provEdgeInfo;
			cityInfo.edgeArray = json.object.cityEdgeInfo;
			fornInfo.edgeArray = json.object.fornEdgeInfo;
			
			//柱状图数据缓存
			provInfo.axis = [];
			provInfo.axisValue = [];
			cityInfo.axis = [];
			cityInfo.axisValue = [];
			fornInfo.axis = [];
			fornInfo.axisValue = [];
			
			//处理省外游客数据
			for( i=0; i<json.object.provList.length; i++ ){
				var proName = json.object.provList[i].prov_name;
				var proValue = json.object.provList[i].vst_person_cnts;

				var obj = {
					"index" : i+1,
					"name"	: proName,
					"value" : proValue
				}
				provInfo.axis.push(proName);
				provInfo.axisValue.push(proValue);
				provInfo.provRankTopArray.push(obj);
			}
			
			//处理省内游客数据
			for( i=0; i<json.object.cityList.length; i++ ){
				var cityName = json.object.cityList[i].city_name;
				var cityValue = json.object.cityList[i].vst_person_cnts;

				var obj = {
					"index" : i+1,
					"name"	: cityName,
					"value" : cityValue
				}
				
				cityInfo.axis.push(cityName);
				cityInfo.axisValue.push(cityValue);
				cityInfo.cityRankTopArray.push(obj);
			}
			
			//处理境外游客数据
			for( i=0; i<json.object.fornList.length; i++ ){
				var fornName = json.object.fornList[i].prov_name;
				var fornValue = json.object.fornList[i].vst_person_cnts;

				var obj = {
					"index" : i+1,
					"name"	: fornName,
					"value" : fornValue
				}
				
				fornInfo.axis.push(fornName);
				fornInfo.axisValue.push(fornValue);
				fornInfo.fornRankTopArray.push(obj);
			}
			
			if( paramObj.startTime == null || paramObj.startTime.length == 0 ){	//初次加载，显示系统出数日期
				var year = json.object.startTime.slice(0,4);
				var month = json.object.startTime.slice(4,6);
				var day = json.object.startTime.slice(6,8);
				var _startTime = year+"-"+month+"-"+day;
				$("#dayStart").val(_startTime.slice(0,10));
				year = json.object.endTime.slice(0,4);
				month = json.object.endTime.slice(4,6);
				day = json.object.endTime.slice(6,8);
				var _endTime = year+"-"+month+"-"+day;
				$("#dayEnd").val(_endTime.slice(0,10));
			}
			
			//判断cityId,是展示全省还是全国数据，isShowProvData置位
//			if( paramObj == null || paramObj.cityId == null || paramObj.cityId.length == 0 ){
//				isShowProvData == 1;
//			}/*else{
//				isShowProvData = false;
//			}*/
			
			
			//渲染饼图
			buildTouristSourcePieChart(json.object.pieData);	
			//渲染排行榜和地图
			refreshPageData();
		}else{
			 alert('查询省内/外游客来源数据出错！');   
		}
	});
	
//	var url = CONTENT_PATH + "/com.asiainfo.zhly.AnalysisAction.queryTouristSourceList.invoke";
//	Base.ajax({
//		url: url,
//		data:paramObj,
//		success: function(req) {
//			
//			var i = 0;
//			provInfo.provRankTopArray = [];
//			cityInfo.cityRankTopArray = [];
//			provInfo.edgeArray = req.provEdgeInfo;
//			cityInfo.edgeArray = req.cityEdgeInfo;
//			
//			//柱状图数据缓存
//			provInfo.axis = [];
//			provInfo.axisValue = [];
//			cityInfo.axis = [];
//			cityInfo.axisValue = [];
//			
//			//处理省外游客数据
//			for( i=0; i<req.provList.length; i++ ){
//				var proName = req.provList[i].prov_name;
//				var proValue = req.provList[i].vst_person_cnts;
//
//				var obj = {
//					"index" : i+1,
//					"name"	: proName,
//					"value" : proValue
//				}
//				provInfo.axis.push(proName);
//				provInfo.axisValue.push(proValue);
//				provInfo.provRankTopArray.push(obj);
//			}
//			
//			//处理省内游客数据
//			for( i=0; i<req.cityList.length; i++ ){
//				var cityName = req.cityList[i].city_name;
//				var cityValue = req.cityList[i].vst_person_cnts;
//
//				var obj = {
//					"index" : i+1,
//					"name"	: cityName,
//					"value" : cityValue
//				}
//				
//				cityInfo.axis.push(cityName);
//				cityInfo.axisValue.push(cityValue);
//				cityInfo.cityRankTopArray.push(obj);
//			}
//			
//			if( paramObj.startTime == null || paramObj.startTime.length == 0 ){	//初次加载，显示系统出数日期
//				var year = req.startTime.slice(0,4);
//				var month = req.startTime.slice(4,6);
//				var day = req.startTime.slice(6,8);
//				$("#dayStart").val(year+"-"+month+"-"+day);
//				
//				year = req.endTime.slice(0,4);
//				month = req.endTime.slice(4,6);
//				day = req.endTime.slice(6,8);
//				$("#dayEnd").val(year+"-"+month+"-"+day);
//				
//				
//			}
//			
//			//判断cityId,是展示全省还是全国数据，isShowProvData置位
//			if( paramObj == null || paramObj.cityId == null || paramObj.cityId.length == 0 ){
//				isShowProvData = true;
//			}/*else{
//				isShowProvData = false;
//			}*/
//			
//			
//			//渲染饼图
//			buildTouristSourcePieChart(req.pieData);	
//			//渲染排行榜和地图
//			refreshPageData();
//			
//		}
//	});
}


/**
 * 
 * @Description : 省/内外top6数据展示在页面上
 * @return void
 * 
 * @author : xuxiong
 * @date : 2015年12月12日 下午16:15
 * 
 */
function buildTouristSourceTable(){
	var htmlContent = "";
	var provRankTopArray = provInfo.provRankTopArray;
	var cityRankTopArray = cityInfo.cityRankTopArray;
	var fornRankTopArray = fornInfo.fornRankTopArray;
	// 前一部分样式 src_blue  后一部分样式 src_grey
	var strFormat = '<li class="$4"><span class="src_top6_sn">$1</span><span class="src_top6_pro">$2</span> <span class="src_top6_num">$3<span style="font-size: 8px;">人数</span></span></li>';
	
	var i = 0;
	var style = "src_blue";
	var halfVar = RANK_TOP_NUM/2;
	if( $("#showTopTitle").text()=="省外来访省份排名TOP6" ){	//展示全国来访数据
		
//		$("#showTopTitle").text("省外来访省份排名TOP"+RANK_TOP_NUM);
//		$("#hideTopTitle").text("省内来访地市排名TOP"+RANK_TOP_NUM);
//		$("#hideTopTitle2").text("境外来访国家排名TOP"+RANK_TOP_NUM);
		for( i=0; i<provRankTopArray.length; i++ ){
			if( i == RANK_TOP_NUM ){ 	//只展示 RANK_TOP_NUM 条记录
				break;
			}
			if( i == halfVar ){	//设置不同展示样式
				style = "src_grey";
			}
			htmlContent += strFormat.replace("$1", provRankTopArray[i].index)
									.replace("$2", provRankTopArray[i].name)
									.replace("$3", provRankTopArray[i].value)
									.replace("$4", style);
		}
	}else if( $("#showTopTitle").text()=="省内来访地市排名TOP6" ){
		
//		$("#showTopTitle").text("省内来访地市排名TOP"+RANK_TOP_NUM);
//		$("#hideTopTitle").text("省外来访省份排名TOP"+RANK_TOP_NUM);
		
		for( i=0; i<cityRankTopArray.length; i++ ){
			if( i == RANK_TOP_NUM ){	//只展示 RANK_TOP_NUM 条记录
				break;
			}
			if( i == halfVar ){
				style = "src_grey";
			}
			htmlContent += strFormat.replace("$1", cityRankTopArray[i].index)
									.replace("$2", cityRankTopArray[i].name)
									.replace("$3", cityRankTopArray[i].value)
									.replace("$4", style);
		}
	}else{
		for( i=0; i<fornRankTopArray.length; i++ ){
			if( i == RANK_TOP_NUM ){	//只展示 RANK_TOP_NUM 条记录
				break;
			}
			if( i == halfVar ){
				style = "src_grey";
			}
			htmlContent += strFormat.replace("$1", fornRankTopArray[i].index)
									.replace("$2", fornRankTopArray[i].name)
									.replace("$3", fornRankTopArray[i].value)
									.replace("$4", style);
		}
	}
	
	$("#sourceRankTable").html(htmlContent);
 }

/**
 * 
 * @Description : 渲染省/内外境外来访人数--饼图展示
 * @return void
 * 
 * @author : xuxiong
 * @date : 2015年12月12日 下午16:15
 * 
 */
function buildTouristSourcePieChart(data) {
	
	hideLoading(myChart_regionPieCharts);
	if (null == data || data.length == 0) {
		
		$('#totalTouristNum').html("-");
		noDataShowSource(myChart_regionPieCharts, 'regionPieChartsDiv');
		return;
	}

	var totalTouristNum = 0;
	var pieData = [];
	var legendData = [];

	for (var i = 0; i < data.length; i++) {
		var proName = data[i].prov_name;
		var proValue = data[i].vst_person_cnts || 0;

		//按顺序设定图例标注
		legendData.push(proName);
		
		//计算总游客人数
		totalTouristNum += parseInt(proValue);
		
		var obj = {
			"value": proValue,
			"name": proName
		}
		pieData.push(obj);
	}
	$('#totalTouristNum').html(totalTouristNum);
	
	require.config({
		paths: {
			echarts: CONTENT_PATH + '/common/js'
		}
	});
	require(['echarts', 'echarts/chart/pie'], function(ec) {
		option = {
			title: {
				text: '',
				x: 'center'
			},
			color: [
				'rgba(78, 202, 238, 1)',
				'rgba(169, 249, 156, 1)',
				'rgba(242, 168, 168, 1)'
			],
			tooltip : {
			    trigger: 'item',
			    formatter: "{b}: <br/> {c} ({d}%)"
			},
			legend: {
				orient: 'vertical',
				x: 'right',
				y:'top',
				data: legendData
			},
			calculable: false,
			series: [{
				name: '',
				type: 'pie',
				radius: '65%',
				center: ['48%', '50%'],
				itemStyle: {
					normal: {
						label: {
							position: 'outer',
							formatter: function(param){
								if( parseFloat(param.percent) != 0.0 ){
									return param.percent+"%";
								}
							},
							textStyle:{
	            				fontSize:14
	            			}
						},
						labelLine: {
							show: false,
							length:-5
						}
					}
				},
				data: pieData
			}]
		};

		myChart_regionPieCharts = ec.init(document.getElementById('regionPieChartsDiv'), 'macarons');
		myChart_regionPieCharts.clear();
		myChart_regionPieCharts.setOption(option);
	});
}

/**
 * 展示全国各省份来访人数迁徙图
 */
function showProvMapCharts(provInfo) {
	var data = provInfo.provRankTopArray;
	
	hideLoading(myChart_regionMapCharts);
	if (null == data || data.length == 0) {
		noDataShowSource(myChart_regionMapCharts, 'regionMapChartsDiv');
		return;
	}

	var lineData = [];
	var valueData = [];
	var realProName = DEPLOY_PROVINCE_NAME_SHORT;	//迁徙目的地

	for (var i = 0; i < data.length; i++) {
		var proName = data[i].name;
		var proValue = data[i].value;

		var proObj2 = [{
			"name": proName,
			"value": proValue
		}, {
			"name": realProName
		}];

		var proObj3 = {
			"name": proName,
			"value": proValue
		};
		lineData.push(proObj2);
		valueData.push(proObj3);
	}
	
	//确定边界
	var edgeArray = provInfo.edgeArray;
	var edge1 = {start:edgeArray[0],end:edgeArray[1]};
	var edge2 = {start:edgeArray[2],end:edgeArray[3]};
	var edge3 = {start:edgeArray[4],end:edgeArray[5]};
	var edge4 = {start:edgeArray[6],end:edgeArray[7]};
	var edge5 = {start:edgeArray[8],end:edgeArray[9]};
	
	require.config({
		paths: {
			echarts: CONTENT_PATH + '/common/js'
		}
	});
	require(['echarts', 'echarts/chart/map', 'echarts/chart/line'], function(ec) {
		option = {
			tooltip: {	//大宽，黄色高亮tip
				trigger: 'item',
				borderRadius: 8,
				borderWidth: 2,
				padding: 10,
				textStyle: {
					color: 'yellow',
					decoration: 'none',
					fontFamily: 'Verdana, sans-serif',
					fontSize: 15,
					fontStyle: 'italic',
					fontWeight: 'bold'
				},
				formatter: function(a, b) {
					if( a.value.length == 0 ){
						return '';
					}							
					return a.value + '人';
				}
			},
			title: {
				text: '省外来访',
				x: 'center'
			},
			dataRange: {
				x: 'left',
				y: 'bottom',
				text: ['高', '低'], // 文本，默认为数值文本
				splitList:[
					edge5,
					edge4,
					edge3,
					edge2,
					edge1
				],
				calculable: false,
				hoverLink:false,
				color: ['#FD3023', '#FF7200', '#FFAE00', '#9BC702', '#46B035'],
				show: true,
				textStyle: {
					color: '#090909'
				}
			},
			series: [{
				type: 'map',
				mapType: 'china',
				roam: false,
				hoverable: false,
				tooltip:{
					show:false
				},
				itemStyle: {
					normal: {
						label: {
							show: true,
							textStyle: {	//地址名称
								color: 'rgba(8,8,8,1)',
								fontSize: 12
							}
						},
						borderColor: 'rgba(46,199,201,1)',
						borderWidth: 1,
						areaStyle: {
							color: '#fff'	//地市填充色
						}
					},
					emphasis: {
						label: {
							show: false
						}
					}
				},
				geoCoord: GEOCOORD_CHINA,
				data:[]
			},{
				type: 'map',
				mapType: 'china',
				data:[],
				markPoint: {
					symbol: 'emptyCircle',
					symbolSize: function(v) {	//标注大小
						var size = 4;
						if( v >= edge2.start && v < edge3.start ){
							size+=1;
						}else if( v >= edge3.start && v < edge4.start ){
							size+=2;
						}else if( v >= edge4.start && v < edge5.start ){
							size+=3;
						}else if( v >= edge5.start ){
							size+=4;
						}
						return size;
					},
					effect: {	//标注图形炫光特效
						show: true,
						shadowBlur: 0	//光影模糊度
					},
					itemStyle: {
						normal: {
							label: {
								show: false
							}
						}
					},
					data: valueData
				}
			},{
				type: 'map',
				mapType: 'china',
				data:[],
				markLine: {
					smooth: true,
					symbol: ['none', 'circle'],
					symbolSize : 1,
					effect: {
						show: true,
						scaleSize: 1,
						period: 30,
						color: '#fff',
						shadowBlur: 10
					},
					itemStyle: {
						normal: {
							borderWidth: 1.0,
							lineStyle: {
								type: 'solid',
								shadowBlur: 6
							},
							label: {
								show: false
							}
						}
					},
					data: lineData
				}
			}]
		};

		myChart_regionMapCharts = ec.init(document.getElementById('regionMapChartsDiv'), 'macarons');
		myChart_regionMapCharts.clear();
		myChart_regionMapCharts.setOption(option);
	});
}

/**
 * 展示全省各地市来访人数迁徙图
 */
function showCityMapCharts(cityInfo) {
	
	var data = cityInfo.cityRankTopArray;
	hideLoading(myChart_regionMapCharts);
	if (null == data || data.length == 0) {
		noDataShowSource(myChart_regionMapCharts, 'regionMapChartsDiv');
		return;
	}

	var lineData = [];
	var valueData = [];
	var realProName = currentCity;
	var cityData = [];
	for (var i = 0; i < data.length; i++) {
		var proName = data[i].name;
		var proValue = data[i].value;
		
		var proObj2 = [{
			"name": proName,
			"value": proValue
		}, {
			"name": realProName
		}];

		var proObj3 = {
			"name": proName,
			"value": proValue
		};

		lineData.push(proObj2);
		valueData.push(proObj3);
	}

	//确定边界
	var edgeArray = cityInfo.edgeArray;
	var edge1 = {start:edgeArray[0],end:edgeArray[1]};
	var edge2 = {start:edgeArray[2],end:edgeArray[3]};
	var edge3 = {start:edgeArray[4],end:edgeArray[5]};
	var edge4 = {start:edgeArray[6],end:edgeArray[7]};
	var edge5 = {start:edgeArray[8],end:edgeArray[9]};
	
	require.config({
		paths: {
			echarts: CONTENT_PATH + '/common/js'
		}
	});
	require(['echarts', 'echarts/chart/map', 'echarts/chart/line'], function(ec) {
		option = {
			tooltip: {
				trigger: 'item',
				borderRadius: 8,
				borderWidth: 2,
				padding: 10,
				textStyle: {
					color: 'yellow',
					decoration: 'none',
					fontFamily: 'Verdana, sans-serif',
					fontSize: 15,
					fontStyle: 'italic',
					fontWeight: 'bold'
				},
				formatter: function(a, b) {
					if( a.value.length == 0 || a.value == '-'){
						return '';
					}							
					return a.value + '人';
				}
			},
			title: {
				text: '省内来访',
				x: 'center'
			},
			dataRange: {
				x: 'left',
				y: 'bottom',
				text: ['高', '低'], // 文本，默认为数值文本
				splitList:[
					edge5,
					edge4,
					edge3,
					edge2,
					edge1
				],
				calculable: false,
				color: ['#FD3023', '#FF7200', '#FFAE00', '#9BC702', '#46B035'],
				show: true,
				textStyle: {
					color: '#090909'
				}
			},
			series: [{
				type: 'map',
				mapType: DEPLOY_PROVINCE_NAME_SHORT,
				roam: false,
				hoverable: false,
				tooltip:{
					show:false
				},
				itemStyle: {
					normal: {
						label: {
							show: true,
							textStyle: {
								color: 'rgba(8,8,8,1)',
								fontSize: 12
							}
						},
						borderColor: 'rgba(46,199,201,1)',
						borderWidth: 1,
						areaStyle: {
							color: '#fff'
						}
					},
					emphasis: {
						label: {
							show: false
						}
					}
				},
				geoCoord: GEOCOORD_SX,
				data: []
			}, {
				type: 'map',
				mapType: DEPLOY_PROVINCE_NAME_SHORT,
				data: [],
				markLine: {
					smooth: true,
					symbol: ['none', 'circle'],
					symbolSize: 1,
					effect: {
						show: true,
						scaleSize: 1,
						period: 30,
						color: '#fff',
						shadowBlur: 10
					},
					itemStyle: {
						normal: {
							borderWidth: 1,
							lineStyle: {
								type: 'solid',
								shadowBlur: 10
							},
							label: {
								show: false
							}
						}
					},
					data: lineData
				},
				markPoint: {
					symbol: 'emptyCircle',
					symbolSize: function(v) {
						var size = 4;
						if( v >= edge2.start && v < edge3.start ){
							size+=1;
						}else if( v >= edge3.start && v < edge4.start ){
							size+=2;
						}else if( v >= edge4.start && v < edge5.start ){
							size+=3;
						}else if( v >= edge5.start ){
							size+=4;
						}
						return size;
					},
					effect: {
						show: true,
						shadowBlur: 0
					},
					itemStyle: {
						normal: {
							label: {
								show: false
							}
						}
					},
					data: valueData
				}
			}]
		};

		myChart_regionMapCharts = ec.init(document.getElementById('regionMapChartsDiv'), 'macarons');
		myChart_regionMapCharts.clear();
		myChart_regionMapCharts.setOption(option);
	});
}

/**
 * 展示世界各国来访人数迁徙图
 */
function showFornMapCharts(fornInfo) {
	
	var data = fornInfo.fornRankTopArray;
	hideLoading(myChart_regionMapCharts);
	if (null == data || data.length == 0) {
		noDataShowSource(myChart_regionMapCharts, 'regionMapChartsDiv');
		return;
	}

	var lineData = [];
	var valueData = [];
	var lineData2 = [];
	var realProName = currentCity;
	var cityData = [];
	for (var i = 0; i < data.length; i++) {
		if(i==FORN_Rank_Top_NUM){
			break;
		}
		var proName = data[i].name;
		var proValue = data[i].value;
		
		var proObj2 = [{
			"name": proName,
			"value": proValue
		}, {
			"name": '中国'//realProName
		}];

		var proObj3 = {
			"name": proName,
			"value": proValue
		};
        
		var proObj4 = [{
			"name": proName,
			"value": proValue
		}, {
			"name": proName
		}];
		lineData.push(proObj2);
		valueData.push(proObj3);
		lineData2.push(proObj4);
	}

	//确定边界
	var edgeArray = fornInfo.edgeArray;
	var edge1 = {start:edgeArray[0],end:edgeArray[1]};
	var edge2 = {start:edgeArray[2],end:edgeArray[3]};
	var edge3 = {start:edgeArray[4],end:edgeArray[5]};
	var edge4 = {start:edgeArray[6],end:edgeArray[7]};
	var edge5 = {start:edgeArray[8],end:edgeArray[9]};
	
	require.config({
		paths: {
			echarts: CONTENT_PATH + '/common/js'
		}
	});
	require(['echarts', 'echarts/chart/map', 'echarts/chart/line'], function(ec) {

		option = {
				//color: ['gold','aqua','lime'],
			    title : {
			        text: '境外来访',
			        x:'center'
			    },
			    tooltip : {
			        trigger: 'item',
			    	borderRadius: 8,
					borderWidth: 2,
					padding: 10,
					textStyle: {
						color: 'yellow',
						decoration: 'none',
						fontFamily: 'Verdana, sans-serif',
						fontSize: 15,
						fontStyle: 'italic',
						fontWeight: 'bold'
					},
					//islandFormatter:'{a} < br/>{b} : {c}',
			        formatter:  //'{b}'
			        	function (v) {
			        	if(v[2]=='-'){return v[1].replace(':', ' > ')}
			        	return v[1].replace(':', ' > ').replace("中国",toolTipPalce)+" "+v[2]+'人';
			        }
			    },
			    dataRange: {
					x: 'left',
					y: 'bottom',
					text: ['高', '低'], // 文本，默认为数值文本
					splitList:[
						edge5,
						edge4,
						edge3,
						edge2,
						edge1
					],
					calculable: false,
					hoverLink:false,
					color: ['#FD3023', '#FF7200', '#FFAE00', '#9BC702', '#46B035'],
					show: true,
					textStyle: {
						color: '#090909'
					}
				},
//				itemStyle:{  
//                    normal:{  
//                           //label:{show:true}  
//                           //,areaStyle:{color:'green'}   //设置地图背景色的颜色设置  
//                           borderColor:'rgba(255,0,255,0.8)' //刚才说的图例颜色设置  
//                    } 
////                    emphasis:{label:{show:true}}  
//                },  
			    series : [
			        {
			            name:'中国',
			            type:'map',
			            mapType: 'world',
			            data:[],
			            itemStyle:{
			                normal:{
			                	areaStyle: {color:'white'},
			                	borderWidth:'1.2',
			                	borderColor:'#79DBDD'},
			                emphasis:{label:{show:true}}
			            },
			            nameMap : NAME_MAP_WORLD,
			            geoCoord: GEOCOORD_WORLD,
			       
			                markLine : {
			            	smooth: true,
							symbol: ['none', 'arrow'],
			                smooth:true,
			                effect : {
			                    show: true,
			                    scaleSize: 1,
			                    period: 30,
			                    color: '#fff',
			                    shadowBlur: 10
			                },
			                itemStyle : {
			                    normal: {
			                        borderWidth:1,
			                        label: {
			                            show: false
			                        },
			                        lineStyle: {
			                            type: 'solid',
			                            shadowBlur: 10
			                          }
			                        }
			                      },
			                data : lineData
			                	},
			                markPoint : {
			                symbol:'emptyCircle',
			                symbolSize: function(v) {	
								var size = 4;
								if( v >= edge2.start && v < edge3.start ){
									size+=1;
								}else if( v >= edge3.start && v < edge4.start ){
									size+=2;
								}else if( v >= edge4.start && v < edge5.start ){
									size+=3;
								}else if( v >= edge5.start ){
									size+=4;
								}
								return size;
							},
			                effect : {
			                    show: true,
			                    shadowBlur : 0
			                },
			                itemStyle:{
			                    normal:{
			                        label:{show:false}
			                    }
			                },
			                data : valueData   	
			            }
			       } /* ,//11111
			       {
			            name:'中国',
			            type:'map',
			            mapType: 'world',
			            data:[],
			            itemStyle:{
			                normal:{
			                	areaStyle: {color:'white'},
			                	borderWidth:'1.2',
			                	borderColor:'#79DBDD'},
			                emphasis:{label:{show:true}}
			            },
			            nameMap : {
			                'Afghanistan':'阿富汗',
			                'Angola':'安哥拉',
			                'Albania':'阿尔巴尼亚',
			                'United Arab Emirates':'阿联酋',
			                'Argentina':'阿根廷',
			                'Armenia':'亚美尼亚',
			                'French Southern and Antarctic Lands':'法属南半球和南极领地',
			                'Australia':'澳大利亚',
			                'Austria':'奥地利',
			                'Azerbaijan':'阿塞拜疆',
			                'Burundi':'布隆迪',
			                'Belgium':'比利时',
			                'Benin':'贝宁',
			                'Burkina Faso':'布基纳法索',
			                'Bangladesh':'孟加拉国',
			                'Bulgaria':'保加利亚',
			                'The Bahamas':'巴哈马',
			                'Bosnia and Herzegovina':'波斯尼亚和黑塞哥维那',
			                'Belarus':'白俄罗斯',
			                'Belize':'伯利兹',
			                'Bermuda':'百慕大',
			                'Bolivia':'玻利维亚',
			                'Brazil':'巴西',
			                'Brunei':'文莱',
			                'Bhutan':'不丹',
			                'Botswana':'博茨瓦纳',
			                'Central African Republic':'中非共和国',
			                'Canada':'加拿大',
			                'Switzerland':'瑞士',
			                'Chile':'智利',
			                'China':'中国',
			                'Ivory Coast':'象牙海岸',
			                'Cameroon':'喀麦隆',
			                'Democratic Republic of the Congo':'刚果民主共和国',
			                'Republic of the Congo':'刚果共和国',
			                'Colombia':'哥伦比亚',
			                'Costa Rica':'哥斯达黎加',
			                'Cuba':'古巴',
			                'Northern Cyprus':'北塞浦路斯',
			                'Cyprus':'塞浦路斯',
			                'Czech Republic':'捷克共和国',
			                'Germany':'德国',
			                'Djibouti':'吉布提',
			                'Denmark':'丹麦',
			                'Dominican Republic':'多明尼加共和国',
			                'Algeria':'阿尔及利亚',
			                'Ecuador':'厄瓜多尔',
			                'Egypt':'埃及',
			                'Eritrea':'厄立特里亚',
			                'Spain':'西班牙',
			                'Estonia':'爱沙尼亚',
			                'Ethiopia':'埃塞俄比亚',
			                'Finland':'芬兰',
			                'Fiji':'斐',
			                'Falkland Islands':'福克兰群岛',
			                'France':'法国',
			                'Gabon':'加蓬',
			                'United Kingdom':'英国',
			                'Georgia':'格鲁吉亚',
			                'Ghana':'加纳',
			                'Guinea':'几内亚',
			                'Gambia':'冈比亚',
			                'Guinea Bissau':'几内亚比绍',
			                'Equatorial Guinea':'赤道几内亚',
			                'Greece':'希腊',
			                'Greenland':'格陵兰',
			                'Guatemala':'危地马拉',
			                'French Guiana':'法属圭亚那',
			                'Guyana':'圭亚那',
			                'Honduras':'洪都拉斯',
			                'Croatia':'克罗地亚',
			                'Haiti':'海地',
			                'Hungary':'匈牙利',
			                'Indonesia':'印尼',
			                'India':'印度',
			                'Ireland':'爱尔兰',
			                'Iran':'伊朗',
			                'Iraq':'伊拉克',
			                'Iceland':'冰岛',
			                'Israel':'以色列',
			                'Italy':'意大利',
			                'Jamaica':'牙买加',
			                'Jordan':'约旦',
			                'Japan':'日本',
			                'Kazakhstan':'哈萨克斯坦',
			                'Kenya':'肯尼亚',
			                'Kyrgyzstan':'吉尔吉斯斯坦',
			                'Cambodia':'柬埔寨',
			                'South Korea':'韩国',
			                'Kosovo':'科索沃',
			                'Kuwait':'科威特',
			                'Laos':'老挝',
			                'Lebanon':'黎巴嫩',
			                'Liberia':'利比里亚',
			                'Libya':'利比亚',
			                'Sri Lanka':'斯里兰卡',
			                'Lesotho':'莱索托',
			                'Lithuania':'立陶宛',
			                'Luxembourg':'卢森堡',
			                'Latvia':'拉脱维亚',
			                'Morocco':'摩洛哥',
			                'Moldova':'摩尔多瓦',
			                'Madagascar':'马达加斯加',
			                'Mexico':'墨西哥',
			                'Macedonia':'马其顿',
			                'Mali':'马里',
			                'Myanmar':'缅甸',
			                'Montenegro':'黑山',
			                'Mongolia':'蒙古',
			                'Mozambique':'莫桑比克',
			                'Mauritania':'毛里塔尼亚',
			                'Malawi':'马拉维',
			                'Malaysia':'马来西亚',
			                'Namibia':'纳米比亚',
			                'New Caledonia':'新喀里多尼亚',
			                'Niger':'尼日尔',
			                'Nigeria':'尼日利亚',
			                'Nicaragua':'尼加拉瓜',
			                'Netherlands':'荷兰',
			                'Norway':'挪威',
			                'Nepal':'尼泊尔',
			                'New Zealand':'新西兰',
			                'Oman':'阿曼',
			                'Pakistan':'巴基斯坦',
			                'Panama':'巴拿马',
			                'Peru':'秘鲁',
			                'Philippines':'菲律宾',
			                'Papua New Guinea':'巴布亚新几内亚',
			                'Poland':'波兰',
			                'Puerto Rico':'波多黎各',
			                'North Korea':'北朝鲜',
			                'Portugal':'葡萄牙',
			                'Paraguay':'巴拉圭',
			                'Qatar':'卡塔尔',
			                'Romania':'罗马尼亚',
			                'Russia':'俄罗斯',
			                'Rwanda':'卢旺达',
			                'Western Sahara':'西撒哈拉',
			                'Saudi Arabia':'沙特阿拉伯',
			                'Sudan':'苏丹',
			                'South Sudan':'南苏丹',
			                'Senegal':'塞内加尔',
			                'Solomon Islands':'所罗门群岛',
			                'Sierra Leone':'塞拉利昂',
			                'El Salvador':'萨尔瓦多',
			                'Somaliland':'索马里兰',
			                'Somalia':'索马里',
			                'Republic of Serbia':'塞尔维亚共和国',
			                'Suriname':'苏里南',
			                'Slovakia':'斯洛伐克',
			                'Slovenia':'斯洛文尼亚',
			                'Sweden':'瑞典',
			                'Swaziland':'斯威士兰',
			                'Syria':'叙利亚',
			                'Chad':'乍得',
			                'Togo':'多哥',
			                'Thailand':'泰国',
			                'Tajikistan':'塔吉克斯坦',
			                'Turkmenistan':'土库曼斯坦',
			                'East Timor':'东帝汶',
			                'Trinidad and Tobago':'特里尼达和多巴哥',
			                'Tunisia':'突尼斯',
			                'Turkey':'土耳其',
			                'United Republic of Tanzania':'坦桑尼亚联合共和国',
			                'Uganda':'乌干达',
			                'Ukraine':'乌克兰',
			                'Uruguay':'乌拉圭',
			                'United States of America':'美国',
			                'Uzbekistan':'乌兹别克斯坦',
			                'Venezuela':'委内瑞拉',
			                'Vietnam':'越南',
			                'Vanuatu':'瓦努阿图',
			                'West Bank':'西岸',
			                'Yemen':'也门',
			                'South Africa':'南非',
			                'Zambia':'赞比亚',
			                'Zimbabwe':'津巴布韦'
			            },
			            geoCoord: {
			              '中国': [DEPLOY_PROVINCE_CORE_LNG,DEPLOY_PROVINCE_CORE_LAT],
			              '安道尔':[1.5,42.5],
			              '阿拉伯联合酋长国':[54,24],
			              '阿富汗':[65,33],
			              '安提瓜和巴布达':[-61.8,17.05],
			              '安圭拉':[-63.1667,18.25],
			              '阿尔巴尼亚':[20,41],
			              '亚美尼亚':[45,40],
			              '荷属安地列斯':[-68.75,12.25],
			              '安哥拉':[18.5,-12.5],
			              '南极洲':[0,-90],
			              '阿根廷':[-64,-34],
			              '美属萨摩亚':[-170,-14.3333],
			              '奥地利':[13.3333,47.3333],
			              '澳大利亚':[133,-27],
			              '阿鲁巴':[-69.9667,12.5],
			              '阿塞拜疆':[47.5,40.5],
			              '波斯尼亚和黑塞哥维那':[18,44],
			              '巴巴多斯':[-59.5333,13.1667],
			              '孟加拉':[90,24],
			              '比利时':[4,50.8333],
			              '布基纳法索':[-2,13],
			              '保加利亚':[25,43],
			              '巴林':[50.55,26],
			              '布隆迪':[30,-3.5],
			              '贝宁':[2.25,9.5],
			              '百慕大':[-64.75,32.3333],
			              '文莱':[114.6667,4.5],
			              '玻利维亚':[-65,-17],
			              '巴西':[-55,-10],
			              '巴哈马':[-76,24.25],
			              '不丹':[90.5,27.5],
			              '布维岛':[3.4,-54.4333],
			              '博茨瓦纳':[24,-22],
			              '白俄罗斯':[28,53],
			              '伯利兹':[-88.75,17.25],
			              '加拿大':[-95,60],
			              '科科斯（基林）群岛':[96.8333,-12.5],
			              '刚果':[25,0],
			              '中非共和国':[21,7],
			              '刚果':[15,-1],
			              '瑞士':[8,47],
			              '科特迪瓦':[-5,8],
			              '库克群岛':[-159.7667,-21.2333],
			              '智利':[-71,-30],
			              '喀麦隆':[12,6],
			              '哥伦比亚':[-72,4],
			              '哥斯达黎加':[-84,10],
			              '古巴':[-80,21.5],
			              '佛得角':[-24,16],
			              '圣诞岛':[105.6667,-10.5],
			              '塞浦路斯':[33,35],
			              '捷克共和国':[15.5,49.75],
			              '德国':[9,51],
			              '吉布提':[43,11.5],
			              '丹麦':[10,56],
			              '多米尼克':[-61.3333,15.4167],
			              '多米尼加共和国':[-70.6667,19],
			              '阿尔及利亚':[3,28],
			              '厄瓜多尔':[-77.5,-2],
			              '爱沙尼亚':[26,59],
			              '埃及':[30,27],
			              '西撒哈拉':[-13,24.5],
			              '厄立特里亚':[39,15],
			              '西班牙':[-4,40],
			              '埃塞俄比亚':[38,8],
			              '芬兰':[26,64],
			              '斐济':[175,-18],
			              '马尔维纳斯群岛':[-59,-51.75],
			              '密克罗尼西亚':[158.25,6.9167],
			              '法罗群岛':[-7,62],
			              '法国':[2,46],
			              '加蓬':[11.75,-1],
			              '英国':[-2,54],
			              '格林纳达':[-61.6667,12.1167],
			              '格鲁吉亚':[43.5,42],
			              '法属圭亚那':[-53,4],
			              '加纳':[-2,8],
			              '直布罗陀':[-5.3667,36.1833],
			              '格陵兰岛':[-40,72],
			              '冈比亚':[-16.5667,13.4667],
			              '几内亚':[-10,11],
			              '瓜德罗普岛':[-61.5833,16.25],
			              '赤道几内亚':[10,2],
			              '希腊':[22,39],
			              '南乔治亚岛和南桑威奇群岛':[-37,-54.5],
			              '危地马拉':[-90.25,15.5],
			              '关岛':[144.7833,13.4667],
			              '几内亚比绍':[-15,12],
			              '圭亚那':[-59,5],
			              '赫德岛和麦当劳群岛':[72.5167,-53.1],
			              '洪都拉斯':[-86.5,15],
			              '克罗地亚':[15.5,45.1667],
			              '海地':[-72.4167,19],
			              '匈牙利':[20,47],
			              '印度尼西亚':[120,-5],
			              '爱尔兰':[-8,53],
			              '以色列':[34.75,31.5],
			              '印度':[77,20],
			              '英属印度洋领地':[71.5,-6],
			              '伊拉克':[44,33],
			              '伊朗':[53,32],
			              '冰岛':[-18,65],
			              '意大利':[12.8333,42.8333],
			              '牙买加':[-77.5,18.25],
			              '乔丹':[36,31],
			              '日本':[138,36],
			              '肯尼亚':[38,1],
			              '吉尔吉斯斯坦':[75,41],
			              '柬埔寨':[105,13],
			              '基里巴斯':[173,1.4167],
			              '科摩罗':[44.25,-12.1667],
			              '圣基茨和尼维斯':[-62.75,17.3333],
			              '朝鲜':[127,40],
			              '韩国':[127.5,37],
			              '科威特':[47.6581,29.3375],
			              '开曼群岛':[-80.5,19.5],
			              '哈萨克斯坦':[68,48],
			              '老挝':[105,18],
			              '黎巴嫩':[35.8333,33.8333],
			              '圣露西亚':[-61.1333,13.8833],
			              '列支敦士登':[9.5333,47.1667],
			              '斯里兰卡':[81,7],
			              '利比里亚':[-9.5,6.5],
			              '莱索托':[28.5,-29.5],
			              '立陶宛':[24,56],
			              '卢森堡':[6.1667,49.75],
			              '拉脱维亚':[25,57],
			              '阿拉伯利比亚民众国':[17,25],
			              '摩洛哥':[-5,32],
			              '摩纳哥':[7.4,43.7333],
			              '摩尔多瓦':[29,47],
			              '黑山':[19,42],
			              '马达加斯加':[47,-20],
			              '马绍尔群岛':[168,9],
			              '马其顿':[22,41.8333],
			              '马里':[-4,17],
			              '缅甸':[98,22],
			              '蒙古':[105,46],
			              '北马里亚纳群岛':[145.75,15.2],
			              '马提尼克岛':[-61,14.6667],
			              '毛里塔尼亚':[-12,20],
			              '蒙特塞拉特':[-62.2,16.75],
			              '马耳他':[14.5833,35.8333],
			              '毛里求斯':[57.55,-20.2833],
			              '马尔代夫':[73,3.25],
			              '马拉维':[34,-13.5],
			              '墨西哥':[-102,23],
			              '马来西亚':[112.5,2.5],
			              '莫桑比克':[35,-18.25],
			              '纳米比亚':[17,-22],
			              '新喀里多尼亚':[165.5,-21.5],
			              '尼日尔':[8,16],
			              '诺福克岛':[167.95,-29.0333],
			              '尼日利亚':[8,10],
			              '尼加拉瓜':[-85,13],
			              '荷兰':[5.75,52.5],
			              '挪威':[10,62],
			              '尼泊尔':[84,28],
			              '瑙鲁':[166.9167,-0.5333],
			              '纽埃':[-169.8667,-19.0333],
			              '新西兰':[174,-41],
			              '阿曼':[57,21],
			              '巴拿马':[-80,9],
			              '秘鲁':[-76,-10],
			              '法属波利尼西亚':[-140,-15],
			              '巴布亚新几内亚':[147,-6],
			              '菲律宾':[122,13],
			              '巴基斯坦':[70,30],
			              '波兰':[20,52],
			              '圣皮埃尔和密克隆岛':[-56.3333,46.8333],
			              '波多黎各':[-66.5,18.25],
			              '葡萄牙':[-8,39.5],
			              '帕劳':[134.5,7.5],
			              '巴拉圭':[-58,-23],
			              '卡塔尔':[51.25,25.5],
			              '留尼旺岛':[55.6,-21.1],
			              '罗马尼亚':[25,46],
			              '塞尔维亚':[21,44],
			              '俄罗斯':[100,60],
			              '卢旺达':[30,-2],
			              '沙特阿拉伯':[45,25],
			              '所罗门群岛':[159,-8],
			              '塞舌尔':[55.6667,-4.5833],
			              '苏丹':[30,15],
			              '瑞典':[15,62],
			              '新加坡':[103.8,1.3667],
			              '斯洛文尼亚':[15,46],
			              '斯洛伐克':[19.5,48.6667],
			              '塞拉利昂':[-11.5,8.5],
			              '圣马力诺':[12.4167,43.7667],
			              '塞内加尔':[-14,14],
			              '索马里':[49,10],
			              '苏里南':[-56,4],
			              '圣多美和普林西比':[7,1],
			              '萨尔瓦多':[-88.9167,13.8333],
			              '叙利亚':[38,35],
			              '斯威士兰':[31.5,-26.5],
			              '特克斯和凯科斯群岛':[-71.5833,21.75],
			              '乍得':[19,15],
			              '多哥':[1.1667,8],
			              '泰国':[100,15],
			              '塔吉克斯坦':[71,39],
			              '托克劳':[-172,-9],
			              '土库曼斯坦':[60,40],
			              '突尼斯':[9,34],
			              '汤加':[-175,-20],
			              '土耳其':[35,39],
			              '特立尼达和多巴哥':[-61,11],
			              '图瓦卢':[178,-8],
			              '坦桑尼亚':[35,-6],
			              '乌克兰':[32,49],
			              '乌干达':[32,1],
			              '美国':[-97,38],
			              '乌拉圭':[-56,-33],
			              '乌兹别克斯坦':[64,41],
			              '委内瑞拉':[-66,8],
			              '越南':[106,16],
			              '瓦努阿图':[167,-16],
			              '瓦利斯和富图纳群岛':[-176.2,-13.3],
			              '萨摩亚':[-172.3333,-13.5833],
			              '也门':[48,15],
			              '马约特':[45.1667,-12.8333],
			              '南非':[24,-29],
			              '赞比亚':[30,-15],
			              '津巴布韦':[30,-20]
			            },
			       
			                markLine : {
			            	smooth: true,
							symbol: ['none', 'circle'],
			                smooth:true,
			                effect : {
			                    show: true,
			                    scaleSize: 1,
			                    period: 30,
			                    color: '#fff',
			                    shadowBlur: 10
			                },
			                itemStyle : {
			                    normal: {
			                        borderWidth:1,
			                        label: {
			                            show: true
			                        },
			                        lineStyle: {
			                            type: 'solid',
			                            shadowBlur: 10
			                        }
			                    }
			                },
			                data : lineData2 //lineData
			            }
			      
			       } */ 
			    ]
		};

		myChart_regionMapCharts = ec.init(document.getElementById('regionMapChartsDiv'), 'macarons');
		myChart_regionMapCharts.clear();
		myChart_regionMapCharts.setOption(option);	
	});
}

function noDataShowSource(chart, id) {
	if (chart == null) {
		require.config({
			paths: {
				echarts: CONTENT_PATH + '/common/js'
			}
		});
		require(['echarts', 'echarts/chart/map', 'echarts/chart/line', 'echarts/chart/bar', 'echarts/chart/pie'], function(ec) {
			chart = ec.init(document.getElementById(id), 'macarons');
			chart.clear();
			showEmptyTip(chart);
		});
	} else {
		showEmptyTip(chart);
	}
}

function showEmptyTip(chart) {
	chart.clear();
	if (chart != null) {
		chart.showLoading({
			text: '当前未查询到数据，请稍后再试',
			effect: 'bubble',
			textStyle: {
				fontSize: 15
			}
		});
	}
}

function hideLoading(chart) {
	if (chart != null) {
		chart.hideLoading();
	}
}


function initDataTime() {
	var dayStart = {
		elem: '#dayStart',
		format: 'YYYY-MM-DD',
		min: laydate.now(-183), //
		max: laydate.now(-1), //最大日期
		istime: false,
		istoday: true,
		choose: function(datas) {
			dayEnd.min = datas; //开始日选好后，重置结束日的最小日期
			dayEnd.start = datas; //将结束日的初始值设定为开始日
		}
	};
	
	var dayEnd = {
		elem: '#dayEnd',
		format: 'YYYY-MM-DD',
		min: laydate.now(-30),
		max: laydate.now(-1),
		istime: false,
		istoday: true,
		choose: function(datas) {
			dayStart.max = datas; //结束日选好后，重置开始日的最大日期
		}
	};
	
	var preMonth = getPreMonth(laydate.now());
	var preYear = laydate.now(-365).slice(0,7);
	var monthStart = {
		elem: '#monthStart',
		format: 'YYYY-MM',
		start:preMonth,
		min: preYear,
		max:preMonth,//开始、结束不能选同一个月；设置此处，可实现
		//max: preMonth, //最大日期
		istime: false,
		festival: true,
		istoday: false,
		choose: function(datas){
			monthEnd.min = datas; //开始日选好后，重置结束日的最小日期
			monthEnd.start = datas //将结束日的初始值设定为开始日
	    }
	};
		
	var monthEnd = {
		elem: '#monthEnd',
		format: 'YYYY-MM',
		start:preMonth,
		min: preYear,
		max:preMonth,//最大日期
		istime: false,
		festival: true,
		istoday: false,
		choose: function(datas){
			monthStart.max = datas; //结束日选好后，重置开始日的最大日期
	    }
	};
	
	laydate(dayStart);
	laydate(dayEnd);
	
	laydate(monthStart);
	laydate(monthEnd);
	
	//默认展示前12个月的数据
	$("#monthStart").val(preYear.slice(0,7));
	$("#monthEnd").val(preMonth.slice(0,7));
	$("#dayStart").val(laydate.now(-8));
	$("#dayEnd").val(laydate.now(-1));
	
}


/**
 * 获取页面参数
 * @returns {String}
 */
function getParamsStr() {
	
	var str = "";
	var cityId= $('#citySelect span li').attr("d_value")|| "";
	var cityName = $('#citySelect span li').text()|| "";
	var regionTypeName = $('#regionTypleSelect span li').text()|| "";
	var regionId=$('#inputselect').val() || "";
	var regionName = $("#divselectInput").val() || "";
	var regionType =  $('#regionTypleSelect span li').attr("d_value");
	var cycleId=$('input[name="dataTimeType"]:checked').val();
	var startTime="";
	var endTime="";
	
	if( cycleId == 'day'){
		startTime = $('#dayStart').val();
		endTime = $('#dayEnd').val();
	}else{
		startTime = $('#monthStart').val();
		endTime = $('#monthEnd').val();
	}

	str += '?cityId=' + cityId;
	str += '&regionId=' + regionId;
	str += '&regionName=' + encodeURIComponent(regionName);
	str += '&regionType=' + regionType;
	str += '&cycleId=' + cycleId;
	str += '&startTime=' + startTime;
	str += '&endTime=' + endTime;
	str += '&cityName='+ encodeURIComponent(cityName);
	str += '&regionTypeName='+ encodeURIComponent(regionTypeName);

	return str;
}
/**
 * 获取当前时间上一个月日期
 * @Description : 
 * 
 * @return void
 *
 * @author : xuxiong
 * @date : 2015年12月18日 下午5:40:08 
 *
 */
function getPreMonth(date) {
    var arr = date.split('-');
    var year = arr[0]; //获取当前日期的年份
    var month = arr[1]; //获取当前日期的月份
    var day = arr[2]; //获取当前日期的日
    var days = new Date(year, month, 0);
    days = days.getDate(); //获取当前日期中月的天数
    var year2 = year;
    var month2 = parseInt(month) - 1;
    if (month2 == 0) {
        year2 = parseInt(year2) - 1;
        month2 = 12;
    }
    var day2 = day;
    var days2 = new Date(year2, month2, 0);
    days2 = days2.getDate();
    if (day2 > days2) {
        day2 = days2;
    }
    if (month2 < 10) {
        month2 = '0' + month2;
    }
    var t2 = year2 + '-' + month2 + '-' + day2;
    return t2;
}
/**
 * 获取页面参数
 * @returns {String}
 */
function getParamsObj() {
	toolTipPalce=$('#citySelect').text()=="全省"?DEPLOY_PROVINCE_NAME:$('#citySelect').text();
	paramObj.cityId = $('#citySelect span li').attr("d_value")|| "";
	paramObj.regionType = $('#regionTypleSelect span li').attr("d_value")|| "";
	paramObj.regionName = $("#divselectInput").val() || "";
	paramObj.regionId = $('#inputselect').val()|| "";
	paramObj.cycleId = $('input[name="dataTimeType"]:checked').val();
	paramObj.startTime="";
	paramObj.endTime="";
	
	if( paramObj.cycleId == 'day'){
		paramObj.startTime = $('#dayStart').val().replace("-","").replace("-","");
		paramObj.endTime = $('#dayEnd').val().replace("-","").replace("-","");
	}else{
		paramObj.startTime = $('#monthStart').val().replace("-","");
		paramObj.endTime = $('#monthEnd').val().replace("-","");
	}
	//如果选择了regionId，则忽略类型参数
	if( paramObj.regionId == null || paramObj.regionId.length == 0 ){
		paramObj.regionType = $('#regionTypleSelect span li').attr("d_value")|| "";
	}
	return paramObj;
}


/**
 * 
 * @Description : 渲染省外游客来源柱状图
 * @return void
 * 
 * @author : xuxiong
 * @date : 2015年11月17日 下午16:01
 * 
 */
function buildProvSourceBar(resultData) {
	
	hideLoading(myChart_regionMapCharts);
	if ( resultData == null || resultData.axis == null || resultData.axis.length == 0 ) {
		noDataShowSource(myChart_regionMapCharts, 'regionMapChartsDiv');
		return;
	}
	
	//展示前10的数据
	//var axis = resultData.axis.slice(0,10);
	//var axisValue = resultData.axisValue.slice(0,10);
	var axis = resultData.axis;
	var axisValue = resultData.axisValue;
	
	var _maxValue = parseInt(axisValue[0] || 0);
	_maxValue = _maxValue * 1.08;	//避免超出范围
	
	require.config({
		paths: {
			echarts: CONTENT_PATH + '/common/js'
		}
	});
	require(
		[
			'echarts',
			'echarts/chart/bar'
		],
		function(ec) {
			option = {
				title: {
					text: '省外游客来访人数',
					x: 'center'
					/*padding:0,
					textStyle:{
						fontSize:12
					}*/
				},
				tooltip: {
					trigger: 'item',
					textStyle : {
						align : 'left'
					},
					formatter: function(params) {
						return params.name + ':</br>' + params.value + '人';
					}
				},
				calculable: true,
				xAxis: [{
					type: 'category',
					show: true,
					data: axis,
					/*axisLabel:{
						interval:0
					}*/
					axisLabel : {
						margin : 5,
						rotate : 45,
						textStyle : {
							align : 'left'
						}
					}
				}],
				yAxis: [{
					name: "人数",
					type: 'value',
					max:_maxValue,
					show: true
				}],
				series: [{
					type: 'bar',
					barWidth: 20,
					itemStyle: {
						normal: {
							label: {
								show: true,
								position: 'top',
								formatter: '{c}'
							}
						}
					},
					data: axisValue
				}]
			};

			myChart_regionMapCharts = ec.init(document.getElementById('regionMapChartsDiv'),'macarons');
			myChart_regionMapCharts.clear();
			myChart_regionMapCharts.setOption(option); 
		}
	);
}

/**
 * 
 * @Description : 渲染境外游客来源柱状图
 * @return void
 * 
 * @author : xuxiong
 * @date : 2015年11月17日 下午16:01
 * 
 */
function buildFornSourceBar(resultData) {
	
	hideLoading(myChart_regionMapCharts);
	if ( resultData == null || resultData.axis == null || resultData.axis.length == 0 ) {
		noDataShowSource(myChart_regionMapCharts, 'regionMapChartsDiv');
		return;
	}
	
	//展示前20的数据
	//var axis = resultData.axis.slice(0,10);
	//var axisValue = resultData.axisValue.slice(0,10);
	var axis = resultData.axis.slice(0,FORN_Rank_Top_NUM);
	var axisValue = resultData.axisValue.slice(0,FORN_Rank_Top_NUM);
	
	var _maxValue = parseInt(axisValue[0] || 0);
	_maxValue = _maxValue * 1.08;	//避免超出范围
	
	require.config({
		paths: {
			echarts: CONTENT_PATH + '/common/js'
		}
	});
	require(
		[
			'echarts',
			'echarts/chart/bar'
		],
		function(ec) {
			option = {
				title: {
					text: '境外游客来访人数',
					x: 'center'
					/*padding:0,
					textStyle:{
						fontSize:12
					}*/
				},
				tooltip: {
					trigger: 'item',
					textStyle : {
						align : 'left'
					},
					formatter: function(params) {
						return params.name + ':</br>' + params.value + '人';
					}
				},
				calculable: true,
				xAxis: [{
					type: 'category',
					show: true,
					data: axis,
					/*axisLabel:{
						interval:0
					}*/
					axisLabel : {
						margin : 5,
						rotate : 45,
						textStyle : {
							align : 'left'
						}
					}
				}],
				yAxis: [{
					name: "人数",
					type: 'value',
					max:_maxValue,
					show: true
				}],
				series: [{
					type: 'bar',
					barWidth: 20,
					itemStyle: {
						normal: {
							label: {
								show: true,
								position: 'top',
								formatter: '{c}'
							}
						}
					},
					data: axisValue
				}]
			};

			myChart_regionMapCharts = ec.init(document.getElementById('regionMapChartsDiv'),'macarons');
			myChart_regionMapCharts.clear();
			myChart_regionMapCharts.setOption(option); 
		}
	);
}

/**
 * 
 * @Description : 渲染省内游客来源柱图
 * @return void
 * 
 * @author : xuxiong
 * @date : 2015年12月11日 下午16:31
 * 
 */
function buildCitySourceBar(resultData) {
	
	hideLoading(myChart_regionMapCharts);
	
	if ( resultData == null || resultData.axis == null || resultData.axis.length == 0 ) {
		noDataShowSource(myChart_regionMapCharts, 'regionMapChartsDiv');
		return;
	}

	var axis = resultData.axis;
	var axisValue = resultData.axisValue;
	
	var _maxValue = parseInt(axisValue[0] || 0);
	_maxValue = _maxValue * 1.08;	//避免超出范围
	
	require.config({
		paths: {
			echarts: CONTENT_PATH + '/common/js'
		}
	});
	require(
		[
			'echarts',
			'echarts/chart/bar'
		],
		function(ec) {
			option = {
				title: {
					text: '省内游客来访人数',
					x: 'center'
				},
				tooltip: {
					trigger: 'item',
					textStyle : {
						align : 'left'
					},
					formatter: function(params) {
						return params.name + ':</br>' + params.value + '人';
					}
				},
				calculable: true,
				xAxis: [{
					type: 'category',
					show: true,
					data: axis
				}],
				yAxis: [{
					name: "人数",
					type: 'value',
					max:_maxValue,
					show: true
				}],
				series: [{
					type: 'bar',
					barWidth: 40,
					itemStyle: {
						normal: {
							label: {
								show: true,
								position: 'top',
								formatter: '{c}'
							}
						}
					},
					data: axisValue
				}]
			};

			myChart_regionMapCharts = ec.init(document.getElementById('regionMapChartsDiv'),'macarons');
			myChart_regionMapCharts.clear();
			myChart_regionMapCharts.setOption(option);
		}
	);
}